#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
string s;
ll len;
bool judge(ll mid){
    for(ll i=0;i+mid-1<=len-1;i++){
        ll j=i+mid-1;
        ll k;
        for(k=i;k<j;k++,j--){
            if(s[k]==s[j])continue;
            else break;
        }
        if(k<j)continue;
        else return true;
    }
    return false;
}

int main()
{
    IOS;
    cin>>s;
    len=s.length();
    ll ans=len;
    while(ans>1){
        if(judge(ans))break;
        ans--;
    }
    cout<<ans<<endl;
    getchar();
    getchar();
    return 0;
}
